package cn.ranko.shiro.service;

import cn.ranko.shiro.mapper.SysPicklistvalueMapper;
import cn.ranko.shiro.model.SysPicklist;
import cn.ranko.shiro.model.SysPicklistvalue;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by zhujun on 2017/9/4.
 */
@Service
public class SysPicklistvalueService {

    @Autowired
    SysPicklistvalueMapper sysPicklistvalueMapper;

    public List<SysPicklistvalue> getByPicklistId(Integer picklist_id) {
        return sysPicklistvalueMapper.getByPicklistId(picklist_id);
    }

    public Integer deletebyPicklistId(Integer picklistId) {
        return sysPicklistvalueMapper.deletebyPicklistId(picklistId);
    }

    public Integer insertPicklistValues(List<SysPicklistvalue> sysPicklistvalues) {
        Integer affectrows = 0;
        for(SysPicklistvalue picklistvalue:sysPicklistvalues){
            affectrows += sysPicklistvalueMapper.insertSelective(picklistvalue);
        }
        return affectrows;
    }
}
